package org.lmw.mm.dao;

import java.util.List;

import com.jfinal.plugin.activerecord.Model;
/**
 * 
 * 此类描述的是：   
 * @author: limengwei   
 * @version: 2014-6-5 上午11:48:07
 */
public class Coment extends Model<Coment> {
  private static final long serialVersionUID = 5021250170901392900L;
  public static final Coment dao=new Coment();
  
  
  public List<Coment> findAll(int pid){
    String sql="select a.*,b.head from mm_coment a,mm_coment_post b where a.pId=? and a.authorId=b.userId and b.postId=a.pId";
    return dao.find(sql,pid);
  }
  
  public Coment findByComentId(int id){
    String sql="select a.*,b.head from mm_coment a left join mm_coment_post b on a.pId=b.postId and a.authorId=b.userId where a.id=?";
    return dao.findFirst(sql,id);
  }
  
}
